<?php

namespace app\admin\model\Third;

use think\Model;
use app\common\model\xilujob\EducationLevel;


class LiveJob extends Model
{

    

    

    // 表名
    protected $name = 'xilujob_live_job';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'status_text'
    ];
    

    
    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')];
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ?: ($data['status'] ?? '');
        $list = $this->getStatusList();
        return $list[$value] ?? '';
    }

    public function company() {
        return $this->belongsTo('LiveCompany', 'live_company_id', 'id');
    }

    public function education() {
        return $this->belongsTo(EducationLevel::class, 'education_level_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }



}
